Conversation
|
@dnwpark must be a member of the Vercel Labs team on Vercel to deploy. Learn more about collaboration on Vercel and other options here. |
a47177d to
4a1e944
Compare
| else: | ||
| annos[k] = v | ||
| elif af := getattr(boxed.cls, "__annotations__", None): | ||
| # TODO: substitute vars in this case |
There was a problem hiding this comment.
We may wish to keep this TODO for the non str case?
| # Replace string annotations with resolved types | ||
| globalns, localns = _get_class_type_hint_namespaces(obj) | ||
| hints = { | ||
| k: _eval_types(v, ctx) |
There was a problem hiding this comment.
Do we need to _eval_types here?
And more generally I suppose, is this where we want to do this?
Maybe we'd want to do it in the helpers for Members?
I'm not sure
There was a problem hiding this comment.
We need something like this to resolve a case like this:
class A:
b: B
class B:
c: C
class C:
pass
t = eval_typing(A)
assert t.__annotations__['b'].__annotations__['c'] is CIf we don't recursively eval, the inner annotations will stay as strings.
There was a problem hiding this comment.
I'm not sure that bothers me
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
|
||
| @_eval_types_impl.register | ||
| def _eval_type_type(obj: type, ctx: EvalContext): | ||
| # Ensure that any string annotations are resolved |
There was a problem hiding this comment.
@dnwpark check if the robot is right about this?
|
Though also I think I stand by that we maybe shouldn't be doing those evaluations anyway. |
Adding
from __future__ import annotationsbreaks a lot of stuff. This is a best attempt at dealing with string annotations.get_local_defnsT | Nonein place when resolved....